<?php

use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
 */

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

// api/posts
Route::get('posts', 'PostsController@index');
Route::get('posts/{post}', 'PostsController@show');

// api/register
Route::post('/register', 'Auth\RegisterController@register');

// api/login
Route::post('/login', 'Auth\LoginController@login');
// api/logout
Route::post('/logout', 'Auth\LoginController@logout');
// api/token/refresh
Route::post('/token/refresh', 'Auth\LoginController@refresh');
// api/profile/edit
Route::middleware('auth:api')->post('/profile/edit', 'ProfileController@update');
// api/password/edit
Route::middleware('auth:api')->post('/password/edit', 'PasswordController@update');
